TaoNhanVienPanel = Ext.extend(AbstractPanel, {
	layout : {
        type : 'vbox',
        align : 'stretch'
    },
    
    height : 900,
    
	initComponent : function() {
		this.formLabel = new Ext.form.Label({
			cls : 'main-title',
			text : lang.text.menu.taoNv.toUpperCase()
		});
		
		this.formLabelContainer = new Ext.Container({
			cls : 'field-align-center',
			items : [this.formLabel]
		});
		
		this.luuBtn = new Ext.Button({
			width : 70,
			text : lang.text.luu
		});
		
		this.btnBar = new Ext.Container({
			layout : 'hbox',
			items : [this.luuBtn]
		});
		
		this.thongTinNVPanel = new ThongTinNhanVienFieldSet();
		
		this.detailContainer = new Ext.Container({
			width : 500,
			layout : 'form',
			height : 500,
			items : [this.thongTinNVPanel, this.btnBar]
		});
		
		this.items = [this.formLabelContainer, {xtype : 'spacer', height : 20},this.detailContainer];
		
		TaoNhanVienPanel.superclass.initComponent.call(this);
	},
	
	afterRender : function(){
		this.submitButtons = [this.luuBtn];
		TaoNhanVienPanel.superclass.afterRender.call(this);
		this.thongTinNVPanel.maNv.on('afterrender', function(){
			var f = this.thongTinNVPanel.maNv.getEl();
            f.focus.defer(200, f);
		}, this);
	},
	
	save : function(){
		this.disableButtons();
		this.getForm().submit({
		    me : this,
		    url : 'nhanVien/save',
		    params : {id : this.domainId},
		    waitMsg: lang.text.saving,
		    waitMsgTarget : true,
            success : function(opts, response) {
            	this.enableButtons();
            	var result = Ext.decode(response.response.responseText);
            	if (result.success) {
            		this.notifyMessage(result.msg);
            		this.getForm().reset();
				} else {
					this.notifyMessage(result.msg);
				}
            	this.thongTinNVPanel.maNv.focus(true);
            },
            failure : function(opts, response) {
            	this.enableButtons();
            	if(response.response){
            		var result = Ext.decode(response.response.responseText);
            		this.thongTinNVPanel.maNv.focus(true);
                	this.notifyMessage(result.msg);
            	}
            },
            scope : this
        }, this);
	}
});